<%@ page language="java" contentType="text/html;charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="${ctx }/css/b.css">
<link rel="stylesheet" type="text/css" href="${ctx}/css/common.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/mybutton.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/css/css.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="${ctx}/assets/js/jquery.min.js" ></script>
<script src="${ctx }/js/ajaxupload.js"></script>
<title>长江师范学院失物招领中心,个人信息</title>
</head>
<body style="background:white;text-align:left;">

<!--导航菜单-->
	<div class="MainMenu" style="margin-bottom: 8px;">
		<div class="MenuList" style="min-width: 500px; background: transparent none repeat scroll 0% 0%;">
			<dl>
				<dt>
					<a href="${ctx }/swzl/index"><div>首页</div></a>
				</dt>
			</dl>
			<dl class="ch">
				<dt>
					<c:if test="${not empty swzlUser}">
						<a href="${ctx }/swzl/userInfo?type=myInfo"><div>${swzlUser.name }</div></a>
					</c:if>
					<c:if test="${empty swzlUser}">
						<a href="${ctx }/swzl/userInfo?type=goLogin"><div>登录/注册</div></a>
					</c:if>
				</dt>
			</dl>
			<dl >
				<dt>
					<a href="${ctx }/swzl/index?typeParentId=1"><div>失物招领</div></a>
				</dt>
			</dl>
			<dl >
				<dt>
					<a href="${ctx }/swzl/index?typeParentId=2"><div>寻物启事</div></a>
				</dt>
			</dl>
			<dl >
				<dt>
					<a href="${ctx }/swzl/index?typeParentId=3"><div>我发布的</div></a>
				</dt>
			</dl>
			
			<c:if test="${not empty swzlUser}">
				<dl>
					<dt>
						<a href="${ctx }/swzl/userInfo?type=loginOut"><div>退出</div></a>
					</dt>
				</dl>
			</c:if>						
		</div>
	</div>
<!-- 导航菜单 -->









<style>
	body { font-size: 72.5%; }
    label, input { display:block; }
    input.text { margin-bottom:12px; width:95%; padding: .4em; }
    fieldset { padding:0; border:0; margin-top:25px; }

    div#users-contain { width: 350px; margin: 20px 0; }
    div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
    div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
    .ui-dialog .ui-state-error { padding: .3em; }
    .validateTips { border: 1px solid transparent; padding: 0.3em; }


body {
  font-family: "Roboto-Regular","微软雅黑", "宋体", Arial, sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: #666666;
  text-align:center;
}

a,
a:link {
  color: #666666;
  text-decoration: none;
}

a:hover,
a:focus {
  color: #005580;
  text-decoration: underline;
}
.user_input{
	border: 1px solid rgb(204, 204, 204);
    box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;
    transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
}	

</style> 




 <div class="content-rightk" style="margin:0 auto;width:1080px;background:transparent;float:none;"> 

        <div class="content-right z_content" style="margin:0 auto;width:1070px;background:transparent;float:none">
          
          	<h5 style="background:#ddd">用户信息<span style="color:red;">(仅主人可见)</span></h5>
          
          <!-- start:表单开始 -->
          <div class="z_from">

            <!-- start:必填信息 -->
            <h4 style="border-top:1px solid #e43716;">基本信息</h4>
            <div style="color:red;">以下信息只有我们网站官方和你本人可以查看,我们只在必要时才会联系你,并且我们会严密保护您的隐私</div>
            <br>            
            <div class="form-horizontal">
            
            <!-- line1 -->
            <!-- line2 -->
              <div class="control-group" style="background:#fff;">
              
              <div style="background:#fff;width:100%;display:inline-block;">
               	<label class="control-label">头像：</label>
                <div class="controls">
                  
                  	<div style="width: 100px;height: 100px;border: 1px solid #ccc;margin-bottom: 10px;">
                  		<img alt="" src="${ctx }/upload/${myInfo.headImg}" id="head_img" style="width: 100px;height: 100px;"/>
                  	</div>
                  	<button style="margin-bottom:8px; width: 100px; display: block;" class="button button-glow button-rounded button-raised button-primary" id="addLabProdPic">更换头像</button>
                </div>
               </div> 
              
              	<div style="background:#fff;width:60%;display:inline-block;"> 
              	
                <label class="control-label">ID：</label>
                <div class="controls">
                <div style="display:inline-block;line-height:20px;" class="notic_info ">
                	<input id="user_id" value="${myInfo.id}"  readonly="readonly" class="user_input" type="text"/>
                </div>
                </div>
                
                </div>
                
                <div style="background:#fff;width:30%;display:inline-block;">

                <label class="control-label">用户类别：</label>
                <div class="controls">
                <div style="display:inline-block;line-height:20px;" class="notic_info">
					<input id="" value="个人用户"  readonly="readonly" class="user_input" type="text"/>
				</div>
                </div>
                
                </div>
                                
              </div>
              
            <!-- line3 -->
              <div class="control-group" style="background:#fff;">
              
              	<div style="background:#fff;width:60%;display:inline-block;"> 
              	
                <label class="control-label">用户名：</label>
                <div class="controls">
                <div style="display:inline-block;width:500px;line-height:20px;background:white" class="notic_info" >
					<input id="" value="${myInfo.userName }"  readonly="readonly" class="user_input" type="text"/>
                </div>
                </div>
                
                </div>
                
                <div style="background:#fff;width:30%;display:inline-block;">

                <label class="control-label">状态：</label>
                <div class="controls">
                <div style="display:inline-block;line-height:20px;" class="notic_info">
					<input id="" value="${myInfo.state==1?'正常':'停用' }"  readonly="readonly" class="user_input" type="text"/>
				</div>
                </div>
                
                </div>
              </div>              
              
            <!-- line4 -->
             <div class="control-group" style="background:#fff;">
             	<div style="background:#fff;width:60%;display:inline-block;"> 
                <label class="control-label">真实姓名：</label>
                <div class="controls">
                  <span class="notic_info">
                  	<input id="name" value="${myInfo.name }" class="user_input" type="text"/>
                  </span>
                </div>
               </div>
               
               <div style="background:#fff;width:30%;display:inline-block;">
               	<label class="control-label">手机：</label>
                <div class="controls">
                  <span class="notic_info">
                  	<input id="phone" value="${myInfo.phone}" class="user_input" type="text"/>
                  </span>
                </div>
               </div>
             </div> 
            
				
			<div class="control-group" style="background:#fff;">
            	<div style="background:#fff;width:60%;display:inline-block;"> 
               <label class="control-label">性别：</label>
               <div class="controls">
                 <span class="notic_info">
	                  <select name="sex" id="sex"  >
					    <option value="男" ${myInfo.sex=='男'?'selected':'' } />男</option>
					    <option value="女" ${myInfo.sex=='女'?'selected':'' }>女</option>
					    <option value="保密" ${myInfo.sex=='保密'?'selected':'' }>保密</option>
					</select>
                 </span>
               </div>
              </div>
              
              <div style="background:#fff;width:30%;display:inline-block;">
              	<label class="control-label">密码：</label>
               <div class="controls">
                 <span class="notic_info">
                 		<input id="pass_word" value="${myInfo.passWord}" class="user_input" type="password"/>
                 </span>
               </div>
              </div>
            </div>   
				
             <div class="control-group" style="background:#fff;">
             	<div style="background:#fff;width:60%;display:inline-block;"> 
                <label class="control-label">省份：</label>
                <div class="controls">
                  <span class="notic_info">
                  	<input id="province" value="${myInfo.province }" class="user_input" type="text"/>
                  </span>
                </div>
               </div>
               
               <div style="background:#fff;width:30%;display:inline-block;">
               	<label class="control-label">市：</label>
                <div class="controls">
                  <span class="notic_info">
                  	<input id="city" value="${myInfo.city}" class="user_input" type="text"/>
                  </span>
                </div>
               </div>
             </div>   
             <div class="control-group" style="background:#fff;">
             	<div style="background:#fff;width:60%;display:inline-block;"> 
                <label class="control-label">区域：</label>
                <div class="controls">
                  <span class="notic_info">
                  	<input id="area" value="${myInfo.area }" class="user_input" type="text"/>
                  </span>
                </div>
               </div>
               
               <div style="background:#fff;width:30%;display:inline-block;">
               	<label class="control-label">详细地址：</label>
                <div class="controls">
                  <span class="notic_info">
                  	<input id="address" value="${myInfo.address}" class="user_input" type="text"/>
                  </span>
                </div>
               </div>
             </div>   
             
                 <div class="control-group" style="background:#fff;">
             	<div style="background:#fff;width:60%;display:inline-block;"> 
                <label class="control-label">年龄：</label>
                <div class="controls">
                  <span class="notic_info">
                  	<input id="age" value="${myInfo.age }" class="user_input" type="text"/>
                  </span>
                </div>
               </div>
               
               <div style="background:#fff;width:30%;display:inline-block;">
               	<label class="control-label">注册日期：</label>
                <div class="controls">
                  <span class="notic_info">
                  	<input id="" value="${myInfo.createTime }" class="user_input" readonly="readonly" type="text"/>
                  </span>
                </div>
               </div>
             </div> 
                           
              
            </div>
         <!-- end:选填信息 -->
         
				        
				           
 
                                  
            <!-- end:联系方式 -->

		
		 <!-- start:验证并提交 -->
            <h4 >操作</h4>
             <div class="form-horizontal" >
             
              <div class="control-group">
                <div class="controls" style="background:#fff;width:800px;">
				
				
<button class="button button-glow button-rounded button-raised button-primary" style="margin:0 7px;width:90px;" onclick="updateUser()">修改</button>					
<!-- 		
<button class="button button-glow button-rounded button-raised button-primary" style="margin:0 7px;width:150px;" onclick="mylost()">我发布的寻物启事</button>					
		
<button class="button button-glow button-rounded button-raised button-primary" style="margin:0 7px;width:150px;" onclick="myfound()">我发布的失物招领</button>

<button class="button button-glow button-rounded button-raised button-primary" style="margin:0 7px;width:120px;" onclick="editMyInfo()">编辑个人资料</button>

<button class="button button-glow button-rounded button-raised button-primary" style="margin:0 7px;width:90px;" onclick="logout()">退出登录</button>	 -->					
				
				
				<br><br>
				</div>
              </div>                
              
              
			</div>
					
			<!-- end:验证并提交 -->
			
			


        

  
</div>			
			
          </div>
        </div>


<br><br>
	

<div style="width: 100%; background: rgb(239, 239, 239) none repeat scroll 0% 0%; padding: 0px; height: 85px; display: block; font-size: 11px; line-height: 15px; margin: 0px; font-family: Roboto-Regular,微软雅黑,宋体,Arial,sans-serif;"> 
      <div style="vertical-align: middle; background: transparent none repeat scroll 0% 0%; padding-top: 8px; text-align: center; color: rgb(102, 102, 102);">
        ©Copyright2017 <a href="#" target="_blank" style="color: rgb(102, 102, 102);">长江师范失物招领</a> All Rights Reserved
	  </div>
       
      <div style="vertical-align: middle; background: transparent none repeat scroll 0% 0%; margin: 10px auto; text-align: center;">
                 邮箱：<a href="#">895243872@qq.com</a>
	  </div>
       
	 	<div style="width: 300px; margin: 0px auto; padding: 0px; text-align: center;">
	 		<a target="_blank" href="#" style="display: inline-block; text-decoration: none; height: 20px; line-height: 20px;">
		 		<img src="${ctx }/images/gongAnBeiAnLogo.png" style="float: left;" data-bd-imgshare-binded="1">
		 		<p style="float: left; height: 20px; line-height: 20px; margin: 0px 0px 0px 5px; color: rgb(147, 147, 147);">
		 			渝公网安备 000000000000000号
		 		</p>
	 		</a>
	 	</div>
		 	   
</div>

<script type="text/javascript">

	function updateUser(){
		var params={"headImg":$("#head_img").attr('src'),"name":$("#name").val(),"phone":$("#phone").val(),"sex":$("#sex").val(),
				"pass_word":$("#pass_word").val(),"province":$("#province").val(),"city":$("#city").val(),"area":$("#area").val(),
				"address":$("#address").val(),"id":$("#user_id").val(),"age":$("#age").val()}
		console.log(params);
		$.ajax({
			  type: 'post',
			  url: "${ctx}/swzl/userInfo?type=updateUser",
			  data: params,
			  dataType: "json",
			  success: function(data){
				  if(data.returnCode==200){
					  location.reload();
				  }else{
					  alert(data.returnMsg);
				  }
			  },error:function(){
				  alert("系统异常");
			  }
		});
		
		
	}
	//上传图片
	new AjaxUpload('#addLabProdPic', {
		action: '${ctx}/upload', 
		name: 'picFile',
		responseType: 'json',
		onSubmit : function(file , ext){
			if (ext && /^(jpg|png|bmp)$/.test(ext.toLowerCase())){
				this.setData({
					'picName': file
				});
			} else {
				alert("请上传格式为 jpg|png|bmp 的图片！");
				return false;				
			}
		},
		onComplete : function(file,response){
			if(response.error) {
				alert(response.error);
				return;
			}
			$('#head_img').attr('src',response.picUrl);
		}		
	});
	
</script>






</body>
</html>

